home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / utils / traceLog.h < prev   
C/C++ Source or Header  |  1991-07-25  |  3KB  |  86 lines

  1. /*
  2.  * traceLog.h --
  3.  *
  4.  *    Definitions for the generalized tracing facility.
  5.  *
  6.  *    These routines are for the SOSP91 paper.
  7.  *
  8.  * Copyright 1991 Regents of the University of California
  9.  * Permission to use, copy, modify, and distribute this
  10.  * software and its documentation for any purpose and without
  11.  * fee is hereby granted, provided that this copyright
  12.  * notice appears in all copies.  The University of California
  13.  * makes no representations about the suitability of this
  14.  * software for any purpose.  It is provided "as is" without
  15.  * express or implied warranty.
  16.  *
  17.  * $Header: /sprite/src/kernel/utils/RCS/traceLog.h,v 1.7 91/07/24 22:13:17 kupfer Exp $ SPRITE (Berkeley)
  18.  */
  19.  
  20. #ifndef _TRACELOG
  21. #define _TRACELOG
  22.  
  23. #include "sysStats.h"
  24. #include "spriteTime.h"
  25.  
  26. /*
  27.  * Information applicable to an entire circular buffer.
  28.  */
  29.  
  30. typedef struct TraceLog_Header {
  31.     int numBuffers;        /* The number of buffers */
  32.     int    firstNewBuffer;        /* The first buffer with new data */
  33.     int    currentBuffer;        /* The number of the current buffer */
  34.     int    currentOffset;        /* Our offset in the buffer */
  35.     int flags;            /* TRACE_INHIBIT, TRACE_NO_TIMES */
  36.     int dataSize;        /* The size of each buffer */
  37.     int    lostRecords;        /* Records lost due to overflow. */
  38.     int    blocked;        /* Set if we're blocked on buffer full. */
  39.     int totalNumRecords;    /* Total records given to record. */
  40.     int totalLostRecords;    /* Total records lost. */
  41.     Sys_TracelogHeaderKern hdr;    /* The header for the user. */
  42.     struct TraceLog_Buffer *buffers;  /* pointer to array of buffers */
  43. } TraceLog_Header;
  44.  
  45. /*
  46.  * Trace Header Flags:
  47.  *
  48.  *    TRACELOG_INHIBIT        - Don't do traces.
  49.  *    TRACELOG_NO_TIMES        - Don't take time stamps, faster.
  50.  *    TRACELOG_NO_BUF            - Return records immediately.
  51.  */
  52.  
  53. #define TRACELOG_INHIBIT        0x0100
  54. #define TRACELOG_NO_TIMES        0x0200
  55. #define TRACELOG_NO_BUF            0x0400
  56.  
  57. /*
  58.  * Information stored per-record.
  59.  */
  60.  
  61. typedef struct TraceLog_Buffer {
  62.     int size;            /* Size in bytes of the actual data. */
  63.                 /* Top byte = flags. */
  64.     int numRecords;        /* Number of records. */
  65.     int    lostRecords;        /* Records lost here due to overflow. */
  66.     int    mode;            /* Inuse, done, unused (for consistency) */
  67.     Address data;        /* Pointer to the data */
  68. } TraceLog_Buffer;
  69.  
  70. #define TRACELOG_INUSE    1
  71. #define TRACELOG_DONE    2
  72. #define TRACELOG_UNUSED    3
  73.  
  74. extern void        TraceLog_Init _ARGS_((TraceLog_Header *tracerPtr,
  75.                        int numBuffers, int size,
  76.                        int flags, int version));
  77. extern void        TraceLog_Insert _ARGS_((TraceLog_Header *traceHdrPtr,
  78.                          Address dataPtr, int size,
  79.                          int flags));
  80. extern ReturnStatus    TraceLog_Dump _ARGS_((TraceLog_Header *traceHdrPtr,
  81.                        Address  dataAddr, Address hdrAddr));
  82. extern void        TraceLog_Reset _ARGS_((TraceLog_Header *traceHdrPtr));
  83. extern void        TraceLog_Finish _ARGS_((TraceLog_Header *traceHdrPtr));
  84.  
  85. #endif /* _TRACELOG */
  86.